#pragma once

/************************************************************************************************
 *  油罐信息管理
 ************************************************************************************************/

#ifndef LHJ_TERMINAL_SERVICE_OIL_TANKS_MANAGER_H__
#define LHJ_TERMINAL_SERVICE_OIL_TANKS_MANAGER_H__

#include <model.h>
#include <map>
#include <memory>
#include <cassert>

namespace cores
{
    namespace devices
    {
        using namespace cores::datas::models::terminal;
        using namespace std;

        class OilTanksManager
        {
        public:
            OilTanksManager();
            virtual ~OilTanksManager();

            static int Count();
            static OilTanksReq *Get(const uint8_t &code);
            static void Add(const OilTanksReq &tank);
            static void Add(const OilTanksReq *tank);
            static void Clear();

        protected:
            virtual int count();
            virtual OilTanksReq *get(const uint8_t &code);
            virtual void add(shared_ptr<OilTanksReq> tank);
            virtual void clear();

        private:
            map<uint8_t, shared_ptr<OilTanksReq>> _tanks;

            static OilTanksManager *globalInstance;
        };
    }
}

#endif